//单文件上传 input图片上传id input隐藏的后台接收得到参数的名称的id，回显的图片的id
function uploadFile(inputId, inputHiddenName, imgId) {
    var formData = new FormData();
    if ($("input[id='" + inputId + "']")[0].files[0] == null) {
        $.modal.alertWarning("请先选择文件路径");
        return false;
    }
    formData.append('file', $("input[id='" + inputId + "']")[0].files[0]);
    $.ajax({
        url: ctx + "common/upload",
        type: 'post',
        cache: false,
        data: formData,
        processData: false,
        contentType: false,
        dataType: "json",
        success: function (result) {
            $("#" + inputHiddenName).val(result.fileName);
            $("#" + imgId).show();
            $("#" + imgId).attr("src", result.url);
        }
    });
}

function cleanFile(imgId,inputHiddenName) {
    $("#" + imgId).hide();
    $("#" + imgId).attr("src", "");
    $("#" + inputHiddenName).val("");
}
